<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        #baEffectCanvase {
            position: fixed;
            pointer-events: none;
            background-color: antiquewhite;
        }

        #baEffectDiv {
            position: fixed;
            width: 100vw;
            height: 100vh;
        }
    </style>
</head>

<body style="background-color: black;height: 200vh;">

    <!-- 这两层是必要的 -->
    <canvas id="baEffectCanvase"><!-- 这里是显示层 --></canvas>
    <div id="baEffectDiv"><!-- 这里是触发层 --></div>

    <button id="but01">emmm</button>

    <!-- 或者把触发层给写到最底下,冒泡触发 -->
    <!-- <div id="baEffectDiv"></div> -->
</body>


<script type="module">
    import baClickEffect from '../js/baEffect/baClickEffect.js'

    //#region gl
    const canvas = document.querySelector("#baEffectCanvase");
    canvas.width = window.innerWidth;
    canvas.height = window.innerHeight - 5;
    let baEffect = new baClickEffect({ canvas: canvas });


    const div1 = document.querySelector('#baEffectDiv');
    div1.addEventListener('mousedown', function (e) {
        const { clientX, clientY } = event;
        baEffect.Trigger([clientX, clientY]);
    });



    const but01 = document.querySelector('#but01');
    but01.addEventListener('click', function () {
        //这个地方没法触发
        console.log('emmmm');
    });


    window.addEventListener('resize', function (e) {
        canvas.width = window.innerWidth;
        canvas.height = window.innerHeight - 5;
    });

    (function ani() {
        baEffect.update();
        requestAnimationFrame(ani);
    })();
</script>
</script>

</html>